package com.glsc.ngateway.common.api.platform.dto.it.networkassets.dict;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.glsc.ngateway.common.api.common.dto.BaseEntityDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * IT网络资产字典根节点
 *
 * @author xuchang
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonInclude
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class ItNetworkAssetsDictDto extends BaseEntityDto implements Serializable {

    private static final long serialVersionUID = -4284324361954038606L;
    @ApiModelProperty(value = "id")
    private Long id;
    @ApiModelProperty(value = "code")
    private String code;
    @ApiModelProperty(value = "描述")
    private String desc;
    @ApiModelProperty(value = "父节点code")
    private String parentCode;
    /**
     * labelField和valueField供前端使用，决定字典下拉框展示哪个字段，并且前后端传参时，传哪个字段
     */
    @ApiModelProperty(value = "前端展示字段")
    private String labelField;
    @ApiModelProperty(value = "前端传参字段")
    private String valueField;

    @ApiModelProperty(value = "层级信息")
    private String level;

    @Builder.Default
    @ApiModelProperty(value = "子节点")
    private List<ItNetworkAssetsDictDto> children = Collections.EMPTY_LIST;

    @Builder.Default
    @ApiModelProperty(value = "字段")
    private List<ItNetworkAssetsDictFieldDto> fieldList = Collections.EMPTY_LIST;

    @ApiModelProperty(value = "属性值, List<Map<字段code, 属性值>>, 全用String类型")
    @Builder.Default
    private List<Map<String, String>> valueList = Collections.EMPTY_LIST;

    @Builder.Default
    @ApiModelProperty(value = "属性值筛选条件")
    private List<ValueFilter> valueFilterList = Collections.EMPTY_LIST;

    @AllArgsConstructor
    @NoArgsConstructor
    @Data
    public static class ValueFilter {
        @ApiModelProperty(value = "字段code筛选")
        private String parentValueCode;
        @ApiModelProperty(value = "字段值筛选")
        private String parentValue;
    }
}
